<template>
  <!-- 等待加密完成再渲染页面 -->
  <template v-if="encryption.done">
    <router-view> </router-view>
  </template>
</template>

<script setup>
import { watch } from 'vue'
import { createSecretAndPublicKey } from '@/utils/crypto'
import { use_encryption_store } from '@/store/encryption'
import { useNavigation } from '@/utils/hooks/useNavigation'
// 生成秘钥获取公钥
createSecretAndPublicKey()

let encryption = use_encryption_store()
watch(
  // 等待页面加密处理完成
  () => encryption.done,
  () => {
    // 一切请求相关的操作，页面初始化等 都在 这里执行
    beReady()
  }
)

function beReady() {
  let { getNavigation } = useNavigation()
  getNavigation() // 获取导航信息
}
</script>

<style lang="scss" scoped></style>
